(use 'psystem.psys)
(load-file "map.clj")

(import myturtle.Turtle)
(import java.awt.Color)


(def o+ (make-obj ['+]))
(def o- (make-obj ['-]))
(def oPUSH (make-obj ['push]))
(def oPOP (make-obj ['pop]))
(def oF (make-obj ['F]))
(def oX (make-obj ['X]))
(def oRED (make-obj ['RED]))
(def oBLACK (make-obj ['BLACK]))
(def oGRAY (make-obj ['GRAY]))
(def oGRN (make-obj ['GREEN]))

(def rt (make-rule-withmove [oF] [oBLACK oF oF o- oPUSH o- oF o+ oF o+ oF oPOP o+ oPUSH o+ oF o- oF o- oF] 3))
(def rtX (make-rule-withmove [oX] [oRED  oX oX o- oPUSH o- oX o+ oX o+ oX oPOP o+ oPUSH o+ oX o- oX o- oX] 3))


;; NOTE: we are re-interpretting symbols here by passing them to a differnet membrane. this is useful!!
;; also note that we need to push oF to the end of the color rules so that we don't lose our 'shape' definitions
(def r-colX (make-rule-withmove [oX] [oRED oX] 1))
(def r-colF (make-rule-withmove [oF] [oBLACK oF] 2)) 

(def m-simple-1 (make-membrane 1 [rtX] [oX] []))
(def m-simple-2 (make-membrane 2 [rt] [oF] []))
(def m3 (make-membrane 3 [r-colX r-colF] [] []))
(def p-simple-1 (make-psystem [m-simple-2 m-simple-1 m3]))


(def membrane-map-tree
     {
      1 object-map-turtle-commands,
      2 object-map-turtle-commands
      })

;;(se-mapper (enumerate-psystem p-simple-1 2) membrane-map-tree)
